<template>
    <div class="rights">
        <el-row>
            <el-col :span="24">
                <el-breadcrumb separator="/">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>权限管理</el-breadcrumb-item>
                    <el-breadcrumb-item>权限列表</el-breadcrumb-item>
                    </el-breadcrumb>
            </el-col>
        </el-row>

          <el-table
            class="margin"
            :data="rigthsList"
            v-loading="loading"
            style="width: 100%">
            <el-table-column
                type="index"
                width="50">
                </el-table-column>
            <el-table-column
                label="权限名称"
                 prop="authName"
                width="180">
            </el-table-column>
             <el-table-column
                label="路径"
                 prop="path"
                width="180">
            </el-table-column>
            <el-table-column label="层级">
                <template slot-scope="scope">
                   <span>{{scope.row.level|filterLeave}}</span>
                </template>
    </el-table-column>
            
    </el-table>
    </div>
</template>
<script>
import {getrightList} from '@/api'
export default {
    data() {
        return {
            loading:true,
            rigthsList:[]
        }
    },
    filters:{
        filterLeave(level){
            if(level=='0'){
                return '一层'
            }else if(level=='1'){
                return '二层'
            }else{
                return '三层'
            }
        }
    },
    created() {
        this.loading=true
        getrightList({type:'list'}).then(res=>{
            console.log(res)
            this.rigthsList=res.data
            this.loading=false
        })
    },
}
</script>
<style lang="scss" scoped>
.rights{
    .margin{
        margin: 20px 0;
    }
}
</style>
